/*
 * PushRequestMessage.h
 *
 */

#ifndef DECLINE_MESSAGE_H_
#define DECLINE_MESSAGE_H_

#include "ariba/ariba.h"

using_serialization;

/**
  * \brief The message object used by our chat application
  *
  * In SpoVNet, you can define your own objects as messages to be sent and received.\n
  * When sent, they are serialized and transmitted, and de-serialized on the receiver size.
  *
  * Please refer to the ariba documentation on how to enable automatic serialization,\n
  * or copy\&paste this header file and its implementation and change it appropriately.
  *
  **/
class DeclineMessage  : public ariba::Message
{
	VSERIALIZEABLE;
public:
    typedef enum
    {
        USER,
        KEY_COLLISION
    } DECLINE_REASON;


	/// Default constructor, required for automatic de-serialization
	DeclineMessage();

	/// Convenient constructor for setting up a new chat message object
	DeclineMessage(bool accept, DECLINE_REASON reason, string key);

	string get_key();
	bool get_accept();
	DECLINE_REASON get_reason();


private:
	uint8_t accept;
	string key; // TODO vielleicht wird das später noch eine "eindeutige" ID
	uint8_t reason;
};

sznBeginDefault(DeclineMessage, X)
{
    X && accept && reason && T(key);
} sznEnd();

#endif /* DECLINE_MESSAGE_H_ */
